﻿using FireChat.Share.Web.Actions;
using Newtonsoft.Json.Converters;
using System.Text.Json.Serialization;

namespace FireChat.Share.Web.Package;


/// <summary>
/// 客户端发来的数据包， 服务器需要处理的包
/// </summary>
public class ClientPackage : IPackage
{
    public static readonly ClientPackage Empty = new()
    {
        Id = ""
    };


    /// <summary>
    /// 数据包Id
    /// </summary>
    public required string Id { get; init; }

    /// <summary>
    /// 服务端动作
    /// </summary>
    [JsonConverter(typeof(StringEnumConverter))]
    public virtual ServertActions ActionType { get; init; } = ServertActions.None;

    /// <summary>
    /// 携带数据
    /// </summary>
    public object? Data { get; init; }
}
